package com.codes.controller;

import com.codes.core.common.result.Result;
import com.codes.service.OrderInfoSV;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Date 2020/5/29 18:39
 * @Created by peanut
 */

@RestController
@Api(tags = "订单详情")
@RequestMapping("/order_info")
public class OrderInfoCtr {


    @Autowired
    private OrderInfoSV orderInfoSV;

    @ApiOperation("货物详情分页")
    @GetMapping("/page")
    public Result page(@RequestParam( defaultValue="1",required=true) int   page,
                       @RequestParam( defaultValue="10",required=true) Integer limit,
                       @RequestParam Map<String,Object> map){

        PageHelper.startPage(page,limit);
        // Map<String, Object> map =  new HashMap<>();
        List<Map<String, Object>> users =orderInfoSV.selectByOrderId(map);
        PageInfo<Map<String, Object>> info = new PageInfo< >(users);
        return Result.pages(info.getList(),(int)info.getTotal());
    }

}